//
//  Blog.m
//  QSBK
//
//  Created by Eric Wang on 4/20/15.
//  Copyright (c) 2015 Eric Wang. All rights reserved.
//

#import "Blog.h"

@implementation Blog
-(void)setUser:(User *)user
{
    _user = user;
}

-(void)setContent:(NSString *)content
{
    if([content isEqual:[NSNull null]]||[content isEqualToString:@""])
    {
        _content = nil;
    }else{
        _content = content;
    }
}

-(void)setComments_count:(NSNumber *)comments_count
{
    if([comments_count isEqual:[NSNull null]])
    {
        _comments_count=[NSNumber numberWithInt:0];
    }else{
        _comments_count = comments_count ;
    }
}

-(void)setImage:(NSString *)image
{
    if([image isEqual:[NSNull null]]||[image isEqualToString:@""])
    {
        _image=nil;
    }else{
        _image=[NSString stringWithFormat:@"http://localhost:8888/thinkphp_3.2.3/users/%@/image/%@",_user.user_id,image];
    }
}

-(void)setPic_url:(NSString *)pic_url
{
    if([pic_url isEqual:[NSNull null]]||[pic_url isEqualToString:@""])
    {
        _pic_url = nil;
    }else{
        _pic_url = pic_url;
    }
}
-(void)setCreated_at:(NSString *)created_at
{
    if([created_at isEqual:[NSNull null]]||[created_at isEqualToString:@""])
    {
        _created_at = nil;
    }else{
        _created_at = created_at;
    }
}
-(void)setDown:(NSNumber *)down
{
    if([down isEqual:[NSNull null]])
    {
        _down = @0;
    }else{
        _down = down;
    }
}
-(void)setUp:(NSNumber *)up
{
    if([up isEqual:[NSNull null]])
    {
        _up = @0;
    }else{
        _up = up;
    }
}

-(void)setState:(NSString *)state
{
    if([state isEqual:[NSNull null]]||[state isEqualToString:@""])
    {
        _state = nil;
    }else{
        _state = state;
    }
}

-(void)setPublished_at:(NSString *)published_at
{
    if([published_at isEqual:[NSNull null]]||[published_at isEqualToString:@""])
    {
        _published_at = nil;
    }else{
        _published_at = published_at;
    }
}
-(void)setTag:(NSString *)tag
{
    if([tag isEqual:[NSNull null]]||[tag isEqualToString:@""])
    {
        _tag = nil;
    }else{
        _tag = tag;
    }
}

-(void)setImage_width:(NSNumber *)image_width
{
    if([image_width isEqual:[NSNull null]])
    {
        _image_width = @0;
    }else{
        _image_width = image_width;
    }
}
-(void)setImage_height:(NSNumber *)image_height
{
    if([image_height isEqual:[NSNull null]])
    {
        _image_height = @0;
    }else{
        _image_height = image_height;
    }
}
-(void)setAllow_comment:(BOOL)allow_comment
{
    _allow_comment = allow_comment;
}
-(void)setArticle_id:(NSNumber *)article_id
{
    if([article_id isEqual:[NSNull null]])
    {
        _article_id = @0;
    }else{
        _article_id = article_id;
    }
            
        
}


-(void)setHigh_url:(NSString *)high_url
{
    if([high_url isEqual:[NSNull null]]||[high_url isEqualToString:@""])
    {
        _high_url= nil;
    }else{
        _high_url = high_url;
    }
}
-(void)setLow_url:(NSString *)low_url
{
    if([low_url isEqual:[NSNull null]]||[low_url isEqualToString:@""])
    {
        _low_url = nil;
    }else{
        _low_url = low_url;
    }
}

@end
